<link rel="stylesheet" href="../component/bootstrap/css/bootstrap-tagsinput.css">

<div class="weibo-content">
    <form class="layui-form" lay-filter="searchWeiboForm">
        <div class="layui-form-item">
            <label class="layui-form-label">微博标题</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <input type="text" name="title" placeholder="请输入标题" class="layui-input"
                       lay-filter="searchWeiboForm">
            </div>
            <label class="layui-form-label">微博标签</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <input type="text" name="tag" placeholder="请输入标签" class="layui-input"
                       lay-filter="searchWeiboForm">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">微博作者</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <input type="text" name="author" placeholder="请输入作者" class="layui-input"
                       lay-filter="searchWeiboForm">
            </div>
            <input class="layui-btn search" type="button" value="搜索" lay-submit lay-filter="searchWeiboForm"/>
        </div>
    </form>
    <blockquote class="layui-elem-quote">
        <button class="layui-btn create-item"><i class="layui-icon">&#xe654;</i>创建微博</button>
    </blockquote>
    <div class="weibo-table"></div>
    <script type="text/html" id="weiboForm">
        <form class="layui-form padding-5 layui-dialog weibo-form">
            <div class="layui-form-item">
                <label class="layui-form-label required">标题：</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
                           autocomplete="off" value="{{d.data.title||''}}"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">logo：</label>
                <div class="layui-input-block">
                    <div class="logo-container">
                        <input type="hidden" name="logo"
                               autocomplete="off" value="{{d.data.logo||''}}"
                               class="layui-input">
                        <div class="logo-img-container">
                            {{# if(d.data.logo){}}
                            <img src="{{d.data.logo||''}}" class="logo-item add-logo"/>
                            {{#}else{}}
                            <span class="logo-placeholder add-logo">+</span>
                            {{#}}}
                        </div>
                    </div>
                </div>
            </div>

            <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label required">标签：</label>-->
            <!--<div class="layui-input-block">-->
            <!--<input type="text" data-role="tagsinput" name="tag" required lay-verify="required"-->
            <!--placeholder="逗号或空格分隔"-->
            <!--autocomplete="off" value="{{d.data.tag||''}}"-->
            <!--class="layui-input">-->
            <!--</div>-->
            <!--</div>-->

            <div class="layui-form-item">
                <label class="layui-form-label required">作者：</label>
                <div class="layui-input-block">
                    <input type="text" name="author" required lay-verify="required"
                           autocomplete="off" value="{{d.data.author||''}}"
                           class="layui-input">
                </div>
            </div>

            <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label required">失效时间：</label>-->
            <!--<div class="layui-input-inline">-->
            <!--<input type="number" name="expireTime" placeholder="6<=失效时间<24"-->
            <!--lay-verify="required|number|expireTime"-->
            <!--autocomplete="off" value="{{d.data.expireTimeInHour || ''}}"-->
            <!--class="layui-input">-->
            <!--</div>-->
            <!--<div class="layui-input-inline line-height-38">小时</div>-->
            <!--</div>-->

            <div class="layui-form-item">
                <label class="layui-form-label required">内容：</label>
                <div class="layui-input-block">
                    <textarea name="content" placeholder="请输入内容"
                              class="layui-textarea textarea-limit">{{d.data.content||''}}</textarea>
                    <span class="textarea-status">
                        {{#if(d.data.content){}}{{d.data.content.length}}/500{{#}}}
                    </span>
                </div>
            </div>

            {{# if(d.model=='addWeiboForm'){}}
            <div class="layui-form-item">
                <label class="layui-form-label">附图：</label>
                <div class="layui-input-block cover-container">
                    <div class="add-cover-btn">
                        <span class="add-icon">+</span>
                    </div>
                </div>
            </div>
            {{# }else{}}
            <div class="layui-form-item">
                <label class="layui-form-label">附图：</label>
                <div class="layui-input-block cover-container">
                    {{# layui.each(d.data.imageArray, function(index, item){ }}
                    <div class="cover">
                        <i class="layui-icon remove-cover">&#x1007;</i>
                        <input type="hidden" name="cover" required lay-verify="required"
                               autocomplete="off" value="{{item||''}}"
                               class="layui-input show-uploader">
                        <img src="{{item||''}}" class="cover-item"/>
                    </div>
                    {{# }); }}

                    <div class="add-cover-btn" {{#if(d.data.imageArray.length>= 3){}}style="display:none;"{{#}}}>
                        <!--<i class="layui-icon">&#xe654;</i>-->
                        <span class="add-icon">+</span>
                    </div>
                </div>
            </div>
            {{#}}}

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn save" lay-submit lay-filter="{{d.model}}">保存</button>
                    <button type="reset" class="layui-btn">重置</button>
                </div>
            </div>
            <input type="hidden" name="id" value="{{d.data.id||''}}"/>
            <input type="hidden" name="channelId" value="2"/>
        </form>
    </script>
</div>

<script src="../component/bootstrap/js/bootstrap-tagsinput.min.js"></script>
<script type="text/javascript" src="../js/weibo.js"></script>